/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ill_be_bach.model;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Abhi
 */
public enum Beat {
    EIGHTH(1),
    QUARTER(2),
    HALF(4),
    WHOLE(8);

     private static final Map<Integer,Beat> lookup
          = new HashMap<Integer,Beat>();
     static {
          for(Beat b : EnumSet.allOf(Beat.class))
               lookup.put(b.getEighthBeatsCount(), b);
     }

    private int eighthBeatsCount ;

    private Beat(int eighthBeatsCount) {
        this.eighthBeatsCount = eighthBeatsCount;
    }

    public int getEighthBeatsCount() {
        return eighthBeatsCount ;
    }

    public static Beat get(int eighthBeatsCount) {
        return lookup.get(eighthBeatsCount);
    }
}
